using mshtml;
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace 阿里妈妈登录
{
	public class TaobaoLoginForm : Form
	{
		public delegate void MsgDelegate(string string_0);
		public delegate void SetTextBoxVerifyDelegate(string string_0);
		public delegate void SetVerifyVisibleDelegate(bool visible);
		public string basePath = Application.StartupPath;
		private bool bool_0;
		private ContextMenuStrip contextMenuStripLoginPage;
		private GroupBox groupBoxUUCode;
		private IContainer icontainer_0;
		private IHTMLDocument2 ihtmldocument2_0;
		private Image image_0;
		private int int_0 = 1;
		private int int_1;
		private int int_2;
		public bool logined;
		public int loginErrCnt;
		public string mainFormTitle = "";
		public string password = "";
		private PictureBox pictureBoxVerify;
		private RichTextBox richTextBoxSts;
		private string string_0 = "";
		private string string_1 = "";
		private string string_2 = "https://login.taobao.com/member/login.jhtml?style=mini&from=taobao&redirectURL=http%3A%2F%2Fwww.taobao.com&amp;full_redirect=true&disableQuickLogin=true";
		private string string_3 = "https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Fwww.taobao.com";
		private TextBox textBoxVerify;
		private System.Windows.Forms.Timer timer_0;
		public string username = "";
		private UUWise uuwise_0 = new UUWise();
		private WebBrowser webBrowserLoginAlimama;
		public TaobaoLoginForm(string[] args)
		{
			try
			{
				if (args == null || args.Length == 0)
				{
					MessageBox.Show("版本：[V" + this.int_0 + "]，本程序不能手动打开！");
					Environment.Exit(-1);
				}
				if (args[0].Contains("CheckUpdVersion"))
				{
					Environment.Exit(this.int_0);
				}
				this.InitializeComponent();
				base.FormClosing += new FormClosingEventHandler(this.TaobaoLoginForm_FormClosing);
				UserAgentHelper.AppendUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36");
				this.webBrowserLoginAlimama.ScriptErrorsSuppressed = true;
				this.webBrowserLoginAlimama.IsWebBrowserContextMenuEnabled = false;
				this.method_0();
				this.method_9("当前IE版本：[" + this.webBrowserLoginAlimama.Version.ToString() + "]");
				int num = 0;
				this.mainFormTitle = args[num++];
				if (int.Parse(args[num++]) == 1)
				{
					this.webBrowserLoginAlimama.Navigate(this.string_3);
					this.username = args[num++];
					this.password = args[num++];
					if (int.Parse(args[num++]) == 1)
					{
						this.string_0 = args[num++];
						this.string_1 = args[num++];
					}
					else
					{
						this.string_0 = "";
						this.string_1 = "";
					}
					this.Text += " - 自动登录模式，如果没出错，不要手动操作";
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 3000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick);
					this.timer_0.Start();
					Thread thread = new Thread(new ThreadStart(this.checkAutoLogin));
					thread.Start();
				}
				else
				{
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					new Thread(new ThreadStart(this.checkManualLogin)).Start();
				}
				new Thread(new ThreadStart(this.setWindowFront)).Start();
			}
			catch (Exception ex)
			{
				if (ex.ToString().Contains("System.IndexOutOfRangeException"))
				{
					this.sendMsgToMainFormAndExit("close", CUtil.FORM_MSG_TYPE_CLOSENOTLOGINED);
				}
				else
				{
					this.method_9("[AlimamaLoginForm]出错！" + ex.ToString());
				}
			}
		}
		public void checkAutoLogin()
		{
			try
			{
				while (!this.logined)
				{
					Thread.Sleep(100);
					this.sendMsgToMainFormAndExit(GetCookie.GetCookieString("http://www.taobao.com"), CUtil.FORM_MSG_TYPE_LOGINED);
				}
			}
			catch (Exception ex)
			{
				this.method_9("[checkAutoLogin]出错！" + ex.ToString());
			}
		}
		public void checkManualLogin()
		{
			try
			{
				while (true)
				{
					string cookieString = GetCookie.GetCookieString("http://www.taobao.com");
					if (!TaobaoSvc.checkTaobaoLogin(cookieString))
					{
						Thread.Sleep(2000);
					}
					else
					{
						base.Visible = true;
						this.sendMsgToMainFormAndExit(cookieString, CUtil.FORM_MSG_TYPE_LOGINED);
					}
				}
			}
			catch (Exception ex)
			{
				this.method_9("[checkManualLogin]出错！" + ex.ToString());
			}
		}
		public void cleanCookie()
		{
			try
			{
				GetCookie.clearIECookie();
				string[] files = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Cookies), "*", SearchOption.AllDirectories);
				for (int i = 0; i < files.Length; i++)
				{
					string path = files[i];
					try
					{
						File.Delete(path);
					}
					catch
					{
					}
				}
				this.webBrowserLoginAlimama.Document.Cookie.Remove(0, this.webBrowserLoginAlimama.Document.Cookie.Length);
			}
			catch (Exception)
			{
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}
		[DllImport("user32.dll", SetLastError = true)]
		private static extern IntPtr FindWindow(string string_4, string string_5);
		[DllImport("user32.dll", SetLastError = true)]
		private static extern IntPtr FindWindowEx(IntPtr intptr_0, uint uint_0, string string_4, string string_5);
		public Point GetOffset(HtmlElement htmlElement_0)
		{
			Point result;
			try
			{
				Point point = new Point(htmlElement_0.OffsetRectangle.Left, htmlElement_0.OffsetRectangle.Top);
				HtmlElement offsetParent = htmlElement_0.OffsetParent;
				while (offsetParent != null)
				{
					point.X += offsetParent.OffsetRectangle.Left;
					point.Y += offsetParent.OffsetRectangle.Top;
					offsetParent = offsetParent.OffsetParent;
				}
				result = point;
			}
			catch (Exception ex)
			{
				this.method_9("[GetOffset]出错！" + ex.ToString());
				result = new Point(0, 0);
			}
			return result;
		}
		private void InitializeComponent()
		{
			this.icontainer_0 = new Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(TaobaoLoginForm));
			this.groupBoxUUCode = new GroupBox();
			this.pictureBoxVerify = new PictureBox();
			this.textBoxVerify = new TextBox();
			this.richTextBoxSts = new RichTextBox();
			this.webBrowserLoginAlimama = new WebBrowser();
			this.contextMenuStripLoginPage = new ContextMenuStrip(this.icontainer_0);
			this.timer_0 = new System.Windows.Forms.Timer(this.icontainer_0);
			this.groupBoxUUCode.SuspendLayout();
			((ISupportInitialize)this.pictureBoxVerify).BeginInit();
			base.SuspendLayout();
			this.groupBoxUUCode.Controls.Add(this.pictureBoxVerify);
			this.groupBoxUUCode.Controls.Add(this.textBoxVerify);
			this.groupBoxUUCode.Location = new Point(8, 12);
			this.groupBoxUUCode.Name = "groupBoxUUCode";
			this.groupBoxUUCode.Size = new Size(258, 66);
			this.groupBoxUUCode.TabIndex = 27;
			this.groupBoxUUCode.TabStop = false;
			this.groupBoxUUCode.Text = "打码区";
			this.groupBoxUUCode.Visible = false;
			this.pictureBoxVerify.BackColor = Color.LightGray;
			this.pictureBoxVerify.BorderStyle = BorderStyle.FixedSingle;
			this.pictureBoxVerify.Location = new Point(14, 18);
			this.pictureBoxVerify.Name = "pictureBoxVerify";
			this.pictureBoxVerify.Size = new Size(150, 40);
			this.pictureBoxVerify.TabIndex = 16;
			this.pictureBoxVerify.TabStop = false;
			this.textBoxVerify.Location = new Point(170, 28);
			this.textBoxVerify.Name = "textBoxVerify";
			this.textBoxVerify.ReadOnly = true;
			this.textBoxVerify.Size = new Size(71, 21);
			this.textBoxVerify.TabIndex = 17;
			this.richTextBoxSts.Location = new Point(4, 471);
			this.richTextBoxSts.Name = "richTextBoxSts";
			this.richTextBoxSts.ReadOnly = true;
			this.richTextBoxSts.Size = new Size(767, 73);
			this.richTextBoxSts.TabIndex = 30;
			this.richTextBoxSts.Text = "";
			this.webBrowserLoginAlimama.ContextMenuStrip = this.contextMenuStripLoginPage;
			this.webBrowserLoginAlimama.Location = new Point(8, 12);
			this.webBrowserLoginAlimama.MinimumSize = new Size(20, 20);
			this.webBrowserLoginAlimama.Name = "webBrowserLoginAlimama";
			this.webBrowserLoginAlimama.Size = new Size(767, 453);
			this.webBrowserLoginAlimama.TabIndex = 29;
			this.contextMenuStripLoginPage.Name = "contextMenuStripLoginPage";
			this.contextMenuStripLoginPage.Size = new Size(61, 4);
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(783, 553);
			base.Controls.Add(this.groupBoxUUCode);
			base.Controls.Add(this.richTextBoxSts);
			base.Controls.Add(this.webBrowserLoginAlimama);
			//base.FormBorderStyle = FormBorderStyle.FixedDialog;
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "TaobaoLoginForm";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "淘宝登录V1";
			this.groupBoxUUCode.ResumeLayout(false);
			this.groupBoxUUCode.PerformLayout();
			((ISupportInitialize)this.pictureBoxVerify).EndInit();
			base.ResumeLayout(false);
		}
		public void messageForThread(string string_4)
		{
			try
			{
				if (this.richTextBoxSts.InvokeRequired)
				{
					TaobaoLoginForm.MsgDelegate method = new TaobaoLoginForm.MsgDelegate(this.messageForThread);
					base.BeginInvoke(method, new object[]
					{
						string_4
					});
				}
				else
				{
					this.method_9(string_4);
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show("[messageForThread]出错：" + ex.ToString());
			}
		}
		private void method_0()
		{
			try
			{
				this.contextMenuStripLoginPage.Items.Add("刷新页面");
				this.contextMenuStripLoginPage.Items[0].Click += new EventHandler(this.method_1);
				this.contextMenuStripLoginPage.Items.Add("重新打开");
				this.contextMenuStripLoginPage.Items[1].Click += new EventHandler(this.method_2);
			}
			catch (Exception ex)
			{
				this.method_9("[initContextMenuStripLoginPage]出错：" + ex.ToString());
			}
		}
		private void method_1(object sender, EventArgs e)
		{
			try
			{
				this.webBrowserLoginAlimama.Refresh();
			}
			catch (Exception ex)
			{
				this.method_9("[RefreshPage_Click]出错：" + ex.ToString());
			}
		}
		private void method_2(object sender, EventArgs e)
		{
			try
			{
				this.webBrowserLoginAlimama.Navigate(this.string_2);
			}
			catch (Exception ex)
			{
				this.method_9("[RefreshPage_Click]出错：" + ex.ToString());
			}
		}
		private void method_3(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				this.sendMsgToMainFormAndExit("close", CUtil.FORM_MSG_TYPE_CLOSENOTLOGINED);
			}
			catch (Exception ex)
			{
				this.method_9("[exitWithOutLogin]出错！" + ex.ToString());
			}
		}
		private Point method_4(Control control_0)
		{
			Point result;
			try
			{
				Point point = new Point(control_0.Left, control_0.Top);
				for (Control parent = control_0.Parent; parent != null; parent = parent.Parent)
				{
					point.X += parent.Left;
					point.Y += parent.Top;
				}
				result = point;
			}
			catch (Exception ex)
			{
				this.method_9("[GetFormOffset]出错！" + ex.ToString());
				result = new Point(0, 0);
			}
			return result;
		}
		private void method_5(object object_0)
		{
			int num = int.Parse(object_0.ToString());
			try
			{
				MockInput.mouseMove(this.int_1, this.int_2, this.int_1 + num);
			}
			catch (Exception ex)
			{
				this.method_9("[drag]出错了！" + ex.ToString());
			}
		}
		private void method_6(object sender, EventArgs e)
		{
			try
			{
				if (this.textBoxVerify.Text.Length > 0)
				{
					this.method_9("完成【验证码】输入！");
					HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("J_CodeInput_i");
					elementById.InvokeMember("focue");
					elementById.InvokeMember("click");
					elementById.SetAttribute("value", this.textBoxVerify.Text);
					HtmlElement elementById2 = this.webBrowserLoginAlimama.Document.GetElementById("TPL_password_1");
					elementById2.InvokeMember("click");
					elementById2.SetAttribute("value", this.password);
					this.webBrowserLoginAlimama.Document.GetElementById("J_SubmitStatic").InvokeMember("click");
					this.textBoxVerify.Text = "";
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 800;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
					this.timer_0.Start();
					this.SetVerifyVisible(false);
				}
			}
			catch (Exception ex)
			{
				this.method_9("[textBoxVerify_TextChanged]出错了！" + ex.ToString());
			}
		}
		private void method_7()
		{
			try
			{
				this.method_9("正在登录UU打码平台！");
				string string_ = this.uuwise_0.login(this.string_0, this.string_1);
				this.bool_0 = true;
				this.method_9(string_);
			}
			catch (Exception ex)
			{
				this.method_9("[uuWiseLogin]出错了！" + ex.ToString());
			}
		}
		private void method_8()
		{
			try
			{
				this.method_9("正在识别验证码！");
				string text = this.uuwise_0.recogniseImg(this.image_0);
				if (text.Equals("TIMEOUT"))
				{
					this.method_9("打码超时，正在重新打码。");
					Thread.Sleep(100);
					this.method_8();
				}
				else
				{
					this.SetTextBoxVerify(text);
					this.method_9("验证码识别成功，验证码：【" + text + "】！");
				}
			}
			catch (Exception ex)
			{
				this.method_9("[recogniseCode]打码出错，正在重新打。" + ex.ToString());
				Thread.Sleep(100);
				this.method_8();
			}
		}
		private void method_9(string string_4)
		{
			try
			{
				string text = this.richTextBoxSts.Text;
				if (text.Length > 5000)
				{
					this.richTextBoxSts.Text = string.Concat(new string[]
					{
						DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"),
						"----",
						string_4,
						"\n",
						text.Substring(0, 5000)
					});
				}
				else
				{
					this.richTextBoxSts.Text = string.Concat(new string[]
					{
						DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"),
						"----",
						string_4,
						"\n",
						text
					});
				}
			}
			catch
			{
				this.messageForThread(string_4);
			}
		}
		[DllImport("User32.dll")]
		private static extern int SendMessage(IntPtr intptr_0, int int_3, int int_4, int int_5);
		public void sendMsgToMainFormAndExit(string string_4, int msgtyp)
		{
			try
			{
				int num = 0;
				IntPtr intPtr;
				while ((intPtr = TaobaoLoginForm.FindWindow(null, this.mainFormTitle)) == IntPtr.Zero && num <= 40)
				{
					num++;
					Thread.Sleep(100);
				}
				if (intPtr == IntPtr.Zero)
				{
					Environment.Exit(0);
				}
				UnicodeEncoding unicodeEncoding = new UnicodeEncoding();
				char[] chars = unicodeEncoding.GetChars(unicodeEncoding.GetBytes(string_4));
				for (int i = 0; i < chars.Length; i++)
				{
					char int_ = chars[i];
					TaobaoLoginForm.SendMessage(intPtr, 1125, (int)int_, 0);
				}
				TaobaoLoginForm.SendMessage(intPtr, 1125, 0, msgtyp);
				Environment.Exit(0);
			}
			catch (Exception ex)
			{
				this.method_9("[sendMessgeToMainForm]出错！" + ex.ToString());
			}
		}
		[DllImport("user32.dll", SetLastError = true)]
		private static extern void SetForegroundWindow(IntPtr intptr_0);
		public void SetTextBoxVerify(string string_4)
		{
			try
			{
				if (this.textBoxVerify.InvokeRequired)
				{
					TaobaoLoginForm.SetTextBoxVerifyDelegate method = new TaobaoLoginForm.SetTextBoxVerifyDelegate(this.SetTextBoxVerify);
					base.BeginInvoke(method, new object[]
					{
						string_4
					});
				}
				else
				{
					this.textBoxVerify.Text = string_4;
				}
			}
			catch (Exception ex)
			{
				this.method_9("[SetTextBoxVerify]出错：" + ex.ToString());
			}
		}
		public void SetVerifyVisible(bool visible)
		{
			try
			{
				if (this.groupBoxUUCode.InvokeRequired)
				{
					TaobaoLoginForm.SetVerifyVisibleDelegate method = new TaobaoLoginForm.SetVerifyVisibleDelegate(this.SetVerifyVisible);
					base.BeginInvoke(method, new object[]
					{
						visible
					});
				}
				else
				{
					this.groupBoxUUCode.Visible = visible;
				}
			}
			catch (Exception ex)
			{
				this.method_9("[SetVerifyVisible]出错：" + ex.ToString());
			}
		}
		public void setWindowFront()
		{
			try
			{
				while (true)
				{
					TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
					base.Activate();
					Thread.Sleep(300);
				}
			}
			catch
			{
			}
		}
		private void TaobaoLoginForm_FormClosing(object sender, FormClosingEventArgs e)
		{
			try
			{
				base.Visible = true;
				string cookieString = GetCookie.GetCookieString("http://www.taobao.com");
				if (TaobaoSvc.checkTaobaoLogin(cookieString))
				{
					this.sendMsgToMainFormAndExit(cookieString, CUtil.FORM_MSG_TYPE_LOGINED);
				}
				else
				{
					this.sendMsgToMainFormAndExit("close", CUtil.FORM_MSG_TYPE_CLOSENOTLOGINED);
				}
			}
			catch (Exception ex)
			{
				this.method_9("[FormClosingProcess]出错，" + ex.ToString());
			}
		}
		private void timer_0_Tick(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				bool flag = false;
				HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("J_QuickLogin");
				if (elementById.Style.Contains("block"))
				{
					IEnumerator enumerator = elementById.GetElementsByTagName("div").GetEnumerator();
					while (enumerator.MoveNext())
					{
						HtmlElement htmlElement = (HtmlElement)enumerator.Current;
						string attribute = htmlElement.GetAttribute("className");
						if (attribute != null && attribute.Contains("item-sso-user") && htmlElement.InnerHtml.Contains(">" + this.username + "<"))
						{
							if (!attribute.Contains("current"))
							{
								htmlElement.InvokeMember("click");
							}
							this.webBrowserLoginAlimama.Document.GetElementById("J_SubmitQuick").InvokeMember("click");
							flag = true;
							this.timer_0 = new System.Windows.Forms.Timer();
							this.timer_0.Interval = 2000;
							this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
							this.timer_0.Start();
							break;
						}
					}
				}
				if (!flag)
				{
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 3000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
					this.timer_0.Start();
				}
			}
			catch (Exception)
			{
				this.timer_0 = new System.Windows.Forms.Timer();
				this.timer_0.Interval = 3000;
				this.timer_0.Tick += new EventHandler(this.timer_0_Tick);
				this.timer_0.Start();
			}
		}
		private void timer_0_Tick_1(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("TPL_username_1");
				if (!(elementById == null) && !this.username.Equals("") && !this.password.Equals(""))
				{
					base.Visible = true;
					base.WindowState = FormWindowState.Normal;
					base.Activate();
					IntPtr intPtr = TaobaoLoginForm.FindWindow(null, this.Text);
					TaobaoLoginForm.SetForegroundWindow(intPtr);
					HtmlElement elementById2 = this.webBrowserLoginAlimama.Document.GetElementById("TPL_username_1");
					Point offset = this.GetOffset(elementById2);
					Point point = this.method_4(this.webBrowserLoginAlimama);
					this.int_1 = point.X + offset.X + 100;
					this.int_2 = point.Y + offset.Y + 35;
					MockInput.click(intPtr, this.int_1, this.int_2);
					elementById.InvokeMember("click");
					elementById.SetAttribute("value", this.username);
					Thread.Sleep(400);
					SendKeys.Send("{TAB}");
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 1500;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_2);
					this.timer_0.Start();
				}
				else
				{
					if (this.loginErrCnt >= 5)
					{
						this.cleanCookie();
						this.method_9("等待【登录页面打开】超过5次！");
						this.loginErrCnt = 0;
						this.webBrowserLoginAlimama.Navigate(this.string_2);
						this.timer_0 = new System.Windows.Forms.Timer();
						this.timer_0.Interval = 3000;
						this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
						this.timer_0.Start();
					}
					else
					{
						this.loginErrCnt++;
						this.timer_0 = new System.Windows.Forms.Timer();
						this.timer_0.Interval = 1000;
						this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
						this.timer_0.Start();
					}
				}
			}
			catch (Exception ex)
			{
				try
				{
					this.cleanCookie();
					this.method_9("[inputAlimamaUserName]出错，等待3秒重试！" + ex.ToString());
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 3000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
					this.timer_0.Start();
				}
				catch (Exception ex2)
				{
					this.method_9("[inputAlimamaUserName]出错！ex1:" + ex2.ToString());
				}
			}
		}
		private void timer_0_Tick_2(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("TPL_password_1");
				elementById.InvokeMember("click");
				elementById.SetAttribute("value", this.password);
				this.timer_0 = new System.Windows.Forms.Timer();
				this.timer_0.Interval = 1000;
				this.timer_0.Tick += new EventHandler(this.timer_0_Tick_3);
				this.timer_0.Start();
			}
			catch (Exception ex)
			{
				try
				{
					this.cleanCookie();
					this.method_9("[inputPassword]出错！" + ex.ToString());
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 3000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
					this.timer_0.Start();
				}
				catch (Exception ex2)
				{
					this.method_9("[inputPassword]出错！ex1:" + ex2.ToString());
				}
			}
		}
		private void timer_0_Tick_3(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				this.webBrowserLoginAlimama.Document.GetElementById("J_SubmitStatic").InvokeMember("click");
				this.timer_0 = new System.Windows.Forms.Timer();
				this.timer_0.Interval = 3000;
				this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
				this.timer_0.Start();
			}
			catch (Exception ex)
			{
				try
				{
					this.cleanCookie();
					this.method_9("[submitLogin]出错！" + ex.ToString());
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 3000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
					this.timer_0.Start();
				}
				catch (Exception ex2)
				{
					this.method_9("[submitLogin]出错！ex1:" + ex2.ToString());
				}
			}
		}
		private void timer_0_Tick_4(object sender, EventArgs e)
		{
			try
			{
				this.timer_0.Stop();
				if (TaobaoSvc.checkTaobaoLogin(GetCookie.GetCookieString("http://www.taobao.com")))
				{
					this.method_9("淘宝登录成功！");
					this.logined = true;
					try
					{
						this.timer_0.Stop();
						goto IL_72B;
					}
					catch
					{
						goto IL_72B;
					}
				}
				if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请输入验证码"))
				{
					if (!this.string_0.Equals("") && !this.string_1.Equals(""))
					{
						this.method_9("出现验证码,开始打码！");
						this.timer_0 = new System.Windows.Forms.Timer();
						this.timer_0.Interval = 500;
						this.timer_0.Tick += new EventHandler(this.timer_0_Tick_5);
						this.timer_0.Start();
					}
					else
					{
						this.method_9("出现验证码，没有设置UU打码打码账号和密码，请手动输入！");
					}
				}
				else
				{
					if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请点击图中的") && this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证通过"))
					{
						this.method_9("点图中文字，验证通过！");
						this.timer_0 = new System.Windows.Forms.Timer();
						this.timer_0.Interval = 100;
						this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
						this.timer_0.Start();
					}
					else
					{
						if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请点击图中的"))
						{
							this.method_9("点图中文字，软件没有办法自动点，请手动点击文字！");
							this.timer_0 = new System.Windows.Forms.Timer();
							this.timer_0.Interval = 10000;
							this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
							this.timer_0.Start();
						}
						else
						{
							if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") && this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证通过"))
							{
								this.method_9("拖动验证通过！");
								this.timer_0 = new System.Windows.Forms.Timer();
								this.timer_0.Interval = 100;
								this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
								this.timer_0.Start();
							}
							else
							{
								if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") && this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("请按住滑块，拖动到最右边"))
								{
									base.Visible = true;
									base.WindowState = FormWindowState.Normal;
									base.Activate();
									TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
									this.method_9("开始拖动滑块。。。。。请等待！");
									Point point = this.method_4(this.webBrowserLoginAlimama);
									HtmlElement elementById = this.webBrowserLoginAlimama.Document.GetElementById("_n1z");
									if (elementById != null)
									{
										this.method_9("旧拖动模式，软件能搞的定！");
										Point offset = this.GetOffset(elementById);
										offset.X += 10;
										offset.Y += 45;
										this.int_1 = offset.X + point.X;
										this.int_2 = offset.Y + point.Y;
										Thread thread = new Thread(new ParameterizedThreadStart(this.method_5));
										thread.Start(string.Concat(220));
									}
									else
									{
										this.method_9("新拖动模式，阿里妈妈又疯了！");
										elementById = this.webBrowserLoginAlimama.Document.GetElementById("nc_1_n1z");
										Point offset = this.GetOffset(elementById);
										offset.X += 10;
										offset.Y += 45;
										this.int_1 = offset.X + point.X;
										this.int_2 = offset.Y + point.Y;
										new Thread(new ParameterizedThreadStart(this.method_5)).Start(string.Concat(270));
									}
									this.timer_0 = new System.Windows.Forms.Timer();
									this.timer_0.Interval = 3000;
									this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
									this.timer_0.Start();
								}
								else
								{
									if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") && this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("加载中"))
									{
										base.Visible = true;
										base.WindowState = FormWindowState.Normal;
										base.Activate();
										TaobaoLoginForm.SetForegroundWindow(TaobaoLoginForm.FindWindow(null, this.Text));
										this.method_9("需要拖动滑块，加载滑块中，请等待！");
										this.timer_0 = new System.Windows.Forms.Timer();
										this.timer_0.Interval = 1000;
										this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
										this.timer_0.Start();
									}
									else
									{
										if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("拖动滑块") && this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("网络不给力"))
										{
											this.method_9("拖动滑块验证失败，重新登录！");
											this.webBrowserLoginAlimama.Navigate(this.string_2);
											this.timer_0 = new System.Windows.Forms.Timer();
											this.timer_0.Interval = 2000;
											this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
											this.timer_0.Start();
										}
										else
										{
											if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("验证码错误，请重新输入"))
											{
												this.method_9("验证码错误，请重新输入！");
												this.timer_0 = new System.Windows.Forms.Timer();
												this.timer_0.Interval = 500;
												this.timer_0.Tick += new EventHandler(this.timer_0_Tick_5);
												this.timer_0.Start();
											}
											else
											{
												if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("账户名和密码不匹配"))
												{
													this.method_9("你输入的账户名和密码不匹配，请手动输入！");
												}
												else
												{
													if (this.webBrowserLoginAlimama.Document.Body.InnerHtml.Contains("网站无法显示该页面"))
													{
														this.method_9("网站无法显示该页面，登录程序重新启动！");
														this.cleanCookie();
														this.sendMsgToMainFormAndExit("restart", CUtil.FORM_MSG_TYPE_NOTOPEN);
													}
													else
													{
														if (this.loginErrCnt >= 8)
														{
															this.method_9("等待检查登录超过8次！");
															this.loginErrCnt = 0;
															this.sendMsgToMainFormAndExit("restart", CUtil.FORM_MSG_TYPE_CHKTMOUT);
														}
														else
														{
															this.loginErrCnt++;
															this.timer_0 = new System.Windows.Forms.Timer();
															this.timer_0.Interval = 1000;
															this.timer_0.Tick += new EventHandler(this.timer_0_Tick_4);
															this.timer_0.Start();
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
				IL_72B:;
			}
			catch (Exception ex)
			{
				try
				{
					this.method_9("[checkLoginSuccess]出错！" + ex.ToString());
					this.webBrowserLoginAlimama.Navigate(this.string_2);
					this.timer_0 = new System.Windows.Forms.Timer();
					this.timer_0.Interval = 2000;
					this.timer_0.Tick += new EventHandler(this.timer_0_Tick_1);
					this.timer_0.Start();
				}
				catch (Exception ex2)
				{
					this.method_9("[checkLoginSuccess]出错！ex1:" + ex2.ToString());
				}
			}
		}
		private void timer_0_Tick_5(object sender, EventArgs e)
		{
			try
			{
				this.SetVerifyVisible(true);
				this.timer_0.Stop();
				if (!this.bool_0)
				{
					this.method_7();
				}
				this.method_9("正在【打码】！");
				this.ihtmldocument2_0 = (IHTMLDocument2)this.webBrowserLoginAlimama.Document.DomDocument;
				HTMLBody hTMLBody = (HTMLBody)this.ihtmldocument2_0.body;
				IHTMLControlRange iHTMLControlRange = (IHTMLControlRange)hTMLBody.createControlRange();
				IHTMLControlElement item = (IHTMLControlElement)this.ihtmldocument2_0.all.item("J_StandardCode_m", 0);
				iHTMLControlRange.add(item);
				iHTMLControlRange.execCommand("Copy", false, null);
				Image image = Clipboard.GetImage();
				this.pictureBoxVerify.Image = image;
				this.textBoxVerify.Focus();
				this.image_0 = image;
				new Thread(new ThreadStart(this.method_8)).Start();
			}
			catch (Exception ex)
			{
				this.method_9("[inputVerifyCode]出错了！" + ex.ToString());
			}
		}
	}
}
